//
//  ZGLWaterCell.m
//  Faker
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "ZGLWaterCell.h"
#import "ZGLPicVCModel.h"
#import <UIImageView+AFNetworking.h>
#import "ZGLPhotoModel.h"

@interface ZGLWaterCell ()

@property (nonatomic, strong) UIImageView *waterImage;

@end

@implementation ZGLWaterCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _waterImage = [[UIImageView alloc] init];
        [self.contentView addSubview:_waterImage];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    [super applyLayoutAttributes:layoutAttributes];
    [_waterImage setFrame:CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height)];
}
- (void)setPhotoModel:(ZGLPicVCModel *)photoModel {
    if (_photoModel != photoModel) {
        _photoModel = photoModel;
    }
    [_waterImage setImageWithURL:[NSURL URLWithString:photoModel.media[0][@"raw_url"]] placeholderImage:[UIImage imageNamed:@"nopic"]];
}



@end
